const path = require('path');
const webpack = require('webpack');

const config = require('./config');

const vendors = ['vue', 'vuex', 'vue-router'];
const webpackDllConfig = {
    mode: 'production',
    entry: {
        'vendors': vendors.concat(config.webpackDLL || [])
    },
    output: {
        filename: '[name]_[chunkhash:8].dll.js',
        library: '[name]_[chunkhash:8]'
    },
    plugins: [
        new webpack.DllPlugin({
            name: '[name]_[chunkhash:8]',
            context: path.join(process.cwd()),
            path: path.join(process.cwd(), '[name]-manifest.json')
        })
    ]
}

module.exports = webpackDllConfig;
